package com.endoc.designpattern.entity.fruit;

import com.endoc.designpattern.entity.Fruit;
import com.endoc.designpattern.visit.Visit;

public class Banana  implements Fruit {
    public void setPrice(int price) {
        this.price = price;
    }

    int price;

    public Banana(int price) {
        this.price = price;
    }

    @Override
    public int price() {
        return price;
    }

    @Override
    public String name() {
        return "香蕉";
    }

    @Override
    public void setVisit(Visit visit) {
        //访问者模式,可得到真实对象
        visit.sell(this);
    }
}
